package com.dxyusn.schedule.elasticjob.springboot.job;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.shardingsphere.elasticjob.api.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
import org.springframework.stereotype.Component;

@Component
public class MySimpleJob implements SimpleJob
{
	public void execute(ShardingContext shardingContext)
	{
		System.out.println(String.format(
				"------【简单任务】Thread ID: %s, %s,任务总片数: %s, " + "当前分片项: %s.当前参数: %s," + "当前任务名称: %s.当前任务参数 %s",
				Thread.currentThread().getId(), new SimpleDateFormat("HH:mm:ss").format(new Date()),
				shardingContext.getShardingTotalCount(), shardingContext.getShardingItem(),
				shardingContext.getShardingParameter(), shardingContext.getJobName(), shardingContext.getJobParameter()

		));
	}
}
